﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Seating.utils
{
    class FormSigletonUtil
    {
        private static Form studentManageFrom;
        public static Form GetStudentManageFromInstance()
        {
            if (HasInstance(studentManageFrom))
            {
                studentManageFrom = new Student_Manage_From();
            }
            return studentManageFrom;
        }

        private static Form adminMainForm;
        public static Form GetAdminMainFormInstance()
        {
            if (HasInstance(adminMainForm))
            {
                adminMainForm = new Admin_Main_Form();
            }
            return adminMainForm;
        }


        private static Form loginForm;
        public static Form GetLoginFormInstance()
        {
            if (HasInstance(loginForm))
            {
                loginForm = new Login_Form();
            }
            return loginForm;
        }

        private static Form studentLoginForm;
        public static Form GeStudentLoginFormInstance()
        {
            if (HasInstance(studentLoginForm))
            {
                studentLoginForm = new Student_Login_Form();
            }
            return studentLoginForm;
        }

        //private static Form seatingChoseForm;
        //public static Form GetSeatingChoseFormInstance()
        //{
        //    if (HasInstance(seatingChoseForm))
        //    {
        //        seatingChoseForm = new Seating_Chose_Form();
        //    }
        //    return seatingChoseForm;
        //}

        private static Form libraryChoseForm;
        public static Form GetLibraryChoseFormInstance()
        {
            if (HasInstance(libraryChoseForm))
            {
                libraryChoseForm = new Library_Chose_Form();
            }
            return libraryChoseForm;
        }
        

        private static bool HasInstance(Form form) {
            return studentManageFrom == null || studentManageFrom.IsDisposed;
        }
    }
}
